package com.zjw.zy.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;
import com.zjw.zy.constant.AppUIColorStyle;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/12/2 16:44
 */
public class UIMode implements Parcelable {

    @AppUIColorStyle.Des
    @SerializedName("colorStyle")
    private final Integer uiMode;

    protected UIMode(Parcel in) {
        if (in.readByte() == 0) {
            uiMode = null;
        } else {
            uiMode = in.readInt();
        }
    }

    @AppUIColorStyle.Des
    public Integer getColorStyle() {
        return uiMode;
    }

    public UIMode(Integer uiMode) {
        this.uiMode = uiMode;
    }

    public static UIMode defaultMode() {
        return new UIMode(AppUIColorStyle.NORMAL_MODE);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (uiMode == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(uiMode);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<UIMode> CREATOR = new Creator<UIMode>() {
        @Override
        public UIMode createFromParcel(Parcel in) {
            return new UIMode(in);
        }

        @Override
        public UIMode[] newArray(int size) {
            return new UIMode[size];
        }
    };
}
